<template>
	<view class="content">
		<view v-for="like in likeEachList">
			<view class=" u-flex u-p-l-30 u-p-t-30 u-p-b-10 u-p-r-30">
				<view class="u-m-r-10" @click="goOrder(like)">
					<u-avatar :src="like.avr" size="100"></u-avatar>
				</view>
				<view class="u-flex-1 text-white margin-left-xs">
					<view class="u-font-16  text-bold" @click="goOrder(like)">{{like.nick}}</view>
					<view class="u-font-14 u-tips-color" @click="goOrder(like)">个性签名:{{like.signature}}</view>
				</view>
				<view class="">
					<view class="round" style="color: white;background: #474966;padding: 10upx 24upx;width: 150upx;text-align: center;font-size: 22upx;" @click="cancelCare(like)">互相关注</view>
				</view>
			</view>
		</view>
		<view v-for="like in likeList">
			<view class=" u-flex u-p-l-30 u-p-t-30 u-p-b-10 u-p-r-30">
				<view class="u-m-r-10" @click="goOrder(like)">
					<u-avatar :src="like.avr" size="100"></u-avatar>
				</view>
				<view class="u-flex-1 text-white margin-left-xs">
					<view class="u-font-16  text-bold" @click="goOrder(like)">{{like.nick}}</view>
					<view class="u-font-14 u-tips-color" @click="goOrder(like)">个性签名:{{like.signature}}</view>
				</view>
				<view v-if="!isCareOther" class="">
					<view class="round" style="color: white;background: #474966;padding: 10upx 24upx;width: 150upx;text-align: center;font-size: 22upx;"  @click="cancelCare(like)">取消关注</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				likeList:[],
				likeEachList:[],
				id:0,
				isCareOther: false
			}
		},
		onLoad(e) {
			this.id = e.id;
		},
		onShow(){			
			let self = this;			
			this.$myRequest({
				url:"/user/getLikesEach?id="+self.id,
				method:"get"
			}).then(r=>{
				self.likeEachList = r.data.data;
			});			
			this.$myRequest({
				url:"/user/getLikes?id="+self.id,		
				method:"get"
			}).then(r=>{
				self.likeList = r.data.data;
			});
		},
		methods: {
			goOrder(e) {
				uni.navigateTo({
					url: '/pages/index/game/user?id='+e.id
				});
			},
			careSomebody(like){
				let self = this;
				this.$myRequest({
					url:"/user/careSomebody/"+self.id+"/"+like.id,
					method:"get"	
				}).then(r=>{
					uni.redirectTo({
					       url: '/my/gird/guanzhu?id='+self.id
					});
				});	
				
			},
			cancelCare(like){
				let self = this;
				this.$myRequest({
					url:"/user/cancelCare/"+self.id+"/"+like.id,		
					method:"get"	
				}).then(r=>{
					uni.redirectTo({
					       url: '/my/gird/guanzhu?id='+self.id
					});
				});	
				
			}
		}
	}
</script>

<style>

</style>
